﻿CREATE PROCEDURE [acms].[User_GetMostRecent]
	@SiteId int,
	@Number int
AS
	
	Select * From
	(
		SELECT *, Rank() over (Order by Created desc) as 'rank'
		From acms.User_View
		Where IsNull(SiteId, @SiteId) = @SiteId
	) as a
	where rank <= @Number
	Order by rank
	
RETURN 0